package siec;

public class Zegar{
    
    private int size = 2;   
    public int clocks[]= new int[size];
    public int localID = 0;
        
    public Zegar(int clientID)
    {
        localID = clientID;
    }
        
    public void setClock(int ktory, int ile)
    {
        clocks[ktory]=ile;
    }
    
    public int getLocalMax()
    {
        return clocks[localID];
    }
    
    public void increment()
    {
        clocks[localID]++;
    }
        
    public String toString()
    {
        String s = new String();  
        s="Serwer | Klient: ";
        for (int i = 0;i<size; i++)
        {
            s += "["+ clocks[i] +"]" ;
        }
        return s;
    }
    
}